import $ from '../common';
Page({
  data: {
    info:[],
    isIphoneX: $.gData().isIphoneX,
    noimg:$.noImage
  },
  onLoad(e) {
    const{group_uuid='',student_uuid='',type='course'}=e
    this.setData({
      group_uuid,
      student_uuid,
      type,
      zonecode:wx.getStorageSync('addresscode')||''
    })
    wx.setNavigationBarTitle({
      title: type=='collection'?'选课详情':'已选课程',
    })
    this.getdetails()

  },
  onShow() {},
  getdetails(){//获取信息
    const{group_uuid,student_uuid,zonecode}=this.data
    $.get('/campus/group/detail',{
      group_uuid,student_uuid,zonecode
    },res=>{
      this.setData({
        info:res
      })
    })
  },
  goclassinfo(e){//去往课时信息
    const{group_uuid,student_uuid}=this.data
    const{type}=e.currentTarget.dataset
    if(type=='detail'){
      $.navigateTo(`/course/classhourinfo?group_uuid=${group_uuid}`)
    }else{
      $.navigateTo(`/course/submitorder?group_uuid=${group_uuid}&student_uuid=${student_uuid}`)
    }
  },
  GoOwnOrder(){//去往我的订单
    $.navigateTo(`/index/ownorder?student_uuid=${this.data.student_uuid}&group_uuid=${this.data.group_uuid}`)
  }
})